<?php
if(ADMIN){
	if(@$_v['act']=='add'&&@$_v['patch']&&$_v['synonim']){
		if(ext_iurl_add($_v['patch'],$_v['synonim'])) echo '<h1>Синоним успешно создан!</h1>';
	}
	elseif(@$_v['act']=='delete'){
		if(ext_iurl_delete($_v['synonim'])) echo '<h1>Синоним успешно удален!</h1>';
	}
	echo '<h2>'.$_l['ext_iurl_add'].'</h2>'.
	'<form method="post" action="">'.
	'<input type="hidden" name="act" value="add" />'.
	'<fieldset><legend>'.$_l['ext_iurl_old'].'</legend>'.
		'<p><strong>'.generate_link('').'</strong><input type="text" name="patch" /></p>'.
	'</fieldset>'.
	'<fieldset><legend>'.$_l['ext_iurl_new'].'</legend>'.
		'<p><strong>'.generate_link('').'</strong><input type="text" name="synonim" />'.
	'</fieldset>'.
	'<br /><input type="submit" id="go" value="Cоздать"><input type="reset" id="cansel" value="Сбросить" />'.
	'</form>';
	// action="'.generate_link('ext=iurl&act=delete').'"
	if($synonims = dir2array($_s['synonim_dir'])){
		echo '<h2>'.$_l['ext_iurl_manage'].'</h2>'.
		'<form method="post" action="">'.
		'<input type="hidden" name="act" value="delete" />'.
		'<ul>';
		foreach ($synonims as $synonim)
			if($f=@file_get_contents($_s['synonim_dir'].'/'.$synonim))
				echo '<li><a href="'.generate_link($synonim).'">'.$synonim.'</a> = <a href="'.generate_link($f).'">'.$f.'</a> <button type="submit" name="synonim" value="'.$synonim.'">'.$_l['ext_iurl_delete'].'</button></li>';
		echo '</ul>'.
		'</form>';
	}
}
else nae_exit($_l['access_denyed']);
